package org.example.game.entity;

import java.awt.*;

public class Bullet extends GameObject {
    private static final int BULLET_SIZE = 8;
    private static final int SPEED = 15;
    
    private int direction;
    private Tank owner;

    public Bullet(int x, int y, int direction, Tank owner) {
        super(x, y, BULLET_SIZE, BULLET_SIZE);
        this.direction = direction;
        this.owner = owner;
    }

    @Override
    public void draw(Graphics g) {
        g.setColor(Color.YELLOW);
        g.fillOval(x, y, width, height);
    }

    public void update() {
        switch (direction) {
            case 0: y -= SPEED; break; // 上
            case 1: x += SPEED; break; // 右
            case 2: y += SPEED; break; // 下
            case 3: x -= SPEED; break; // 左
        }
    }

    public Tank getOwner() {
        return owner;
    }
} 